package cn.edu.scau.cmi.zenghanxiong.client;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import cn.edu.scau.cmi.zenghanxiong.hibernate.DAO.StudentDAO;
import cn.edu.scau.cmi.zenghanxiong.hibernate.DAO.TeacherDAO;
import cn.edu.scau.cmi.zenghanxiong.spring.domain.Student;
import cn.edu.scau.cmi.zenghanxiong.spring.domain.Teacher;
import cn.edu.scau.cmi.zenghanxiong.spring.util.ApplicationContextUtil;

public class Spring03SingletonApplicationContextClient{
	private static Teacher liangzaoqing;
	private static Student zhangsan;

	public Spring03SingletonApplicationContextClient() {
	}

	public static void main(String[] args) {
		ApplicationContext ac = getApplicationContext();
		Student zhangsan=(Student) ac.getBean("zhangsan");
		System.out.println(zhangsan.getName()+"的毕业设计指导导师是："+zhangsan.getTutor().getName());
	}


	private static ApplicationContext getApplicationContext() {
		ApplicationContext applicationContext=ApplicationContextUtil.getApplicationContext();
		return applicationContext;
	}
}
